package com.ys.sb.hessian.config;

import com.ys.sb.hessian.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.remoting.caucho.HessianServiceExporter;

@Configuration
public class HessianConfig {


    /**
     * 服务暴露
     * @param helloService
     * @return
     */
    @Bean(name = "/helloService.service")
    public HessianServiceExporter exportService(@Autowired HelloService helloService) {
        HessianServiceExporter exporter = new HessianServiceExporter();
        exporter.setService(helloService);
        exporter.setServiceInterface(HelloService.class);
        return exporter;
    }
}
